import request from "./request";
import type { IbannerList } from "@/components/Banner/index.vue"
// 轮播图+标题数据
type IcurrentCategory = {
    id: number|string,
    superCategoryId?: number,
    showIndex?: number,
    name?: string,
    frontName?: string,
    frontNameIcon?: any,
    frontDesc?: string,
    bannerUrl?: string,
    bannerList: IbannerList[],
    iconUrl?: string,
    imgUrl?: any,
    level?: string,
    subCateList?: [],
    wapBannerUrl?: string,
    type?: number,
    wapExpandPicTargetUrl?: number,
    categoryType?: number,
    extra?: any
}
// 定义价格
interface IfinalPrice {
    prefix: string,
    price: string | number,
    suffix: any
}
// 定义价格栏目
type IpriceInfo = {
    finalPrice: IfinalPrice,
    counterPrice: string | number,
    basicPrice: any
}
// 价格栏目活动
interface IpriceInfoBanner {
    logo: any |string,
    title: null | string,
    price: null | string,
    content: string |null
}
// 最终价格 信息操作系统 
type IfinalPriceInfoVO = {
    banner: IpriceInfoBanner,
    priceInfo: IpriceInfo,
    type: any
}
// 单个商品的右上角logo
interface ItopLogoYc {
    logoUrl: string,
    width: number,
    height: number,
    type: number
}
// 活动
interface IgoodItemTag {
    type: number,
    subType: number,
    name: string,
    tagId: number,
    itemId: number,
    forbidJump: boolean,
    freshmanExclusive: boolean
}
// 名称左边小logo
interface IpreLogo {
    logoUrl: string,
    width: number,
    height: number,
    type: number,
}
// 单个商品数据类型
export type IgoodCardItemList = {
    id: number,
    listPicUrl: string,
    name: string,
    seoTitle: any,
    simpleDesc: string,
    primaryPicUrl: string,
    primarySkuId: number,
    retailPrice: number,
    counterPrice: number,
    sortOriginPrice: number,
    status: number,
    updateTime: number,
    itemTagList: IgoodItemTag[],
    finalPriceInfoVO: IfinalPriceInfoVO,
    topLogo: ItopLogoYc,
    preLogo: IpreLogo[]
}
// 每块商品组的类型
interface IgoodCardTitle {
    id: number,
    superCategoryId: number,
    showIndex: number,
    name: string,
    frontName: string,
    frontNameIcon: any,
    frontDesc: string,
    bannerUrl: any,
    bannerList: any,
    iconUrl: any,
    imgUrl: any,
    level: string,
    subCateList: [],
    wapBannerUrl: string,
    type: number,
    wapExpandPicTargetUrl: any,
    categoryType: number,
    extra: any
}
// 每个商品模块
export type IgoodCard = {
    category: IgoodCardTitle,
    itemList: IgoodCardItemList[],
    itemIdList: [],
}
// 请求中的data数据
export type IDavPageData = {
    currentCategory: IcurrentCategory,
    categoryItemList: IgoodCard[],
    categoryList: []
}
// DavPage页面数据类型
export type IDavPageList = {
    YXJSONArray: any,
    global: any,
    data: IDavPageData,
    YXJSONObject: any
}

export default {
    // 请求DavPage页面数据 导航页面
    getDavPageData(categoryId: number, style: string) {
        return request.get<any, IDavPageList>(`item/list.json?categoryId=${categoryId}&style=${style}`)
    }
}